package com.lzb.musicplayer.bean;

import android.text.TextUtils;

import java.io.Serializable;
import java.util.Objects;

public class MusicFile implements Serializable {
    private String path;
    private String title;
    private String artist;  //艺术家
    private String album;//专辑名称
    private String genre;
    private String wjPath;
    private long duration;
    private long albumId;
    private long albumCover;
    private long artistCover;
    private long albumCount;
    private boolean isPlay;
    private String  groupKey;


    public String getGroupKey() {
        return groupKey;
    }

    public void setGroupKey(String groupKey) {
        this.groupKey = groupKey;
    }

    public boolean isPlay() {
        return isPlay;
    }

    public void setPlay(boolean play) {
        isPlay = play;
    }

    public long getAlbumCount() {
        return albumCount;
    }

    public void setAlbumCount(long albumCount) {
        this.albumCount = albumCount;
    }

    public void setAlbumId(long albumId) {
        this.albumId = albumId;
    }

    public long getAlbumCover() {
        return albumCover;
    }

    public long getArtistCover() {
        return artistCover;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public String getTitle() {
        if (TextUtils.isEmpty(title)){
            return "未知";
        }
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getArtist() {
        return artist;
    }

    public void setArtist(String artist) {
        this.artist = artist;
    }

    public String getAlbum() {
        return album;
    }

    public void setAlbum(String album) {
        this.album = album;
    }

    public String getGenre() {
        if (TextUtils.isEmpty(genre)){
            return "未知";
        }
        return genre;
    }

    public void setGenre(String genre) {
        this.genre = genre;
    }

    public long getDuration() {
        return duration;
    }

    public void setDuration(long duration) {
        this.duration = duration;
    }

    // 新增字段
    public boolean albumCoverLoading = false;
    public boolean artistCoverLoading = false;

    // Getters & Setters
    public void setAlbumCover(long albumCover) {
        this.albumCover = albumCover;
        this.albumCoverLoading = false;
    }

    public void setArtistCover(long artistCover) {
        this.artistCover = artistCover;
        this.artistCoverLoading = false;
    }

    public long getAlbumId() {
        return albumId;
    }

    public String getWjPath() {
        return wjPath;
    }

    public void setWjPath(String wjPath) {
        this.wjPath = wjPath;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null || getClass() != obj.getClass()) return false;
        MusicFile musicFile = (MusicFile) obj;
        return duration == musicFile.duration && albumId == musicFile.albumId
                && albumCover == musicFile.albumCover && artistCover == musicFile.artistCover
                && albumCount == musicFile.albumCount && isPlay == musicFile.isPlay
                && Objects.equals(path, musicFile.path)
                && Objects.equals(title, musicFile.title)&& Objects.equals(artist, musicFile.artist)
                && Objects.equals(album, musicFile.album)&& Objects.equals(genre, musicFile.genre)
                && Objects.equals(wjPath, musicFile.wjPath) ;
    }


    @Override
    public int hashCode() {
        return Objects.hash(path, title,artist, album,
                genre, duration,albumId, albumCover,artistCover,wjPath,albumCount,isPlay);
    }
}